//
// Created by root on 20-2-17.
//

#ifndef XDYNAMIC_ART_METHOD_H
#define XDYNAMIC_ART_METHOD_H

#include <jni.h>
#include "primitive_types.h"

class ArtMethod{
public:
    ArtMethod(jmethodID method);

    static void SystemReady();

    static void SetMethodSize(size_t size);
    static size_t GetMethodSize();

    static void SetAccessFlagsOffset(offset_t offset);
    static offset_t GetAccessFlagsOffset();

    void SetAccessFlags(u4 access_flags);

    u4 GetAccessFlags();

    bool HasAccessFlags(u4 af_bit);

    void RemoveAccessFlags(u4 af_bit);

    void AddAccessFlags(u4 af_bit);

    jclass GetDeclaringClass(JNIEnv *env);

    jobject ToReflectedMethod(JNIEnv *env);
private:
    jmethodID mMethod;
};
#endif //XDYNAMIC_ART_METHOD_H
